﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Security;

namespace SpaceNeedle.City6473.Web.Data
{
    public class Security
    {
        /// <summary>
        /// Criptografa um texto sem possibilidade de volta
        /// </summary>
        /// <param name="value">valor a ser codificado</param>
        /// <returns>retorna o hash criado</returns>
        public static string Encode(string value)
        {
            var hash = System.Security.Cryptography.SHA1.Create();
            var encoder = new System.Text.UTF8Encoding();
            var combined = encoder.GetBytes(value);

            return BitConverter.ToString(hash.ComputeHash(combined)).ToLower().Replace("-", "");
        }
    }
}
